package buffer;

import java.util.ArrayList;
import main.Collector;
import main.Message;

/**
 *
 * @author x3m
 */
public class MessageBuffer {

    private static MessageBuffer _instance = null;
    private static ArrayList<Message> _msg = null;

    public synchronized static MessageBuffer getInstance() {
        if (_instance == null) {
            doUpdate();
        }
        return _instance;
    }

    public synchronized static void doUpdate() {
        _instance = new MessageBuffer();
        _msg = Collector.getLastMessages();
    }
    
    public static ArrayList<Message> getMessages(){
        return _msg;
    }
}
